<?php
use think\Route;

$afterBehavior = [
    '\app\admin\behavior\ApiAuth',
    '\app\admin\behavior\ApiPermission',
    '\app\admin\behavior\AdminLog'
];


//一些带有特殊参数的路由写到这里
Route::rule([
    'admin/Login/index'  => [
        'admin/Login/index',
        ['method'=>'post']
    ],
    'admin/Index/upload' => [
        'admin/Index/upload',
        [
            'method' => 'post'
        ]
    ],
    'admin/Login/logout' => [
        'admin/Login/logout',
        [
            'method' => 'get', 'after_behavior' => ['\app\admin\behavior\ApiAuth', '\app\admin\behavior\AdminLog']
        ]
    ]
]);


//大部分控制器的路由都以分组的形式写到这里
Route::group('admin',function(){
        Route::group('Examinee',[
            'index'=> [
                'admin/Examinee/index',
                ['method' => 'get']
            ],
            'eRoomGetList'=> [
                'admin/Examinee/eRoomGetList',
                ['method' => 'get']
            ],
            'eHistoryGetList'=> [
                'admin/Examinee/eHistoryGetList',
                ['method' => 'get']
            ],
            'eRoomExamineeList'=> [
                'admin/Examinee/eRoomExamineeList',
                ['method' => 'get']
            ],
            'changeStatus' =>[
                'admin/Examinee/changeStatus',
                ['method' => 'get']
            ],
            'add' =>[
                'admin/Examinee/add',
                ['method' => 'post']
            ],
            'edit' =>[
                'admin/Examinee/edit',
                ['method' => 'post']
            ],
            'del' =>[
                'admin/Examinee/del',
                ['method' => 'get']
            ],
            'getDetail' =>[
                'admin/Examinee/getDetail',
                ['method' => 'get']
            ],
            'getExamineeNum' =>[
                'admin/Examinee/getExamineeNum',
                ['method' => 'get']
            ],
            'getTodayExamineeNum' =>[
                'admin/Examinee/getTodayExamineeNum',
                ['method' => 'get']
            ],
            'getAllExamineeAge' =>[
                'admin/Examinee/getAllExamineeAge',
                ['method' => 'get']
            ],
            'getTestPersonnelNum' =>[
                'admin/Examinee/getTestPersonnelNum',
                ['method' => 'get']
            ],
            'isExist' =>[
                'admin/Examinee/isExist',
                ['method' => 'get']
            ],
            'login' =>[
                'admin/Examinee/login',
                ['method' => 'post']
            ]
        ]);
        Route::group('AcademicRecords',[
            'index'=> [
                'admin/AcademicRecords/index',
                ['method' => 'get']
            ],
            'add' =>[
                'admin/AcademicRecords/add',
                ['method' => 'post']
            ],
            'edit' =>[
                'admin/AcademicRecords/edit',
                ['method' => 'post']
            ],
            'getDetail' =>[
                'admin/AcademicRecords/getDetail',
                ['method' => 'get']
            ]            
        ]);
        Route::group('TestPaper',[
            'index'=> [
                'admin/TestPaper/index',
                ['method' => 'get']
            ],
            'changeStatus' =>[
                'admin/TestPaper/changeStatus',
                ['method' => 'get']
            ],
            'add' =>[
                'admin/TestPaper/add',
                ['method' => 'post']
            ],
            'edit' =>[
                'admin/TestPaper/edit',
                ['method' => 'post']
            ],
            'del' =>[
                'admin/TestPaper/del',
                ['method' => 'get']
            ],
            'getDetail' =>[
                'admin/TestPaper/getDetail',
                ['method' => 'get']
            ]          
        ]);
        Route::group('ExaminationRoom',[
            'index'=> [
                'admin/ExaminationRoom/index',
                ['method' => 'get']
            ],
            'changeStatus' =>[
                'admin/ExaminationRoom/changeStatus',
                ['method' => 'get']
            ],
            'add' =>[
                'admin/ExaminationRoom/add',
                ['method' => 'post']
            ],
            'edit' =>[
                'admin/ExaminationRoom/edit',
                ['method' => 'post']
            ],
            'del' =>[
                'admin/ExaminationRoom/del',
                ['method' => 'get']
            ],
            'getDetail' =>[
                'admin/ExaminationRoom/getDetail',
                ['method' => 'get']
            ],
            'examineeERoomList' =>[
                'admin/ExaminationRoom/examineeERoomList',
                ['method' => 'post']
            ],
            'examineeERoomList2' =>[
                'admin/ExaminationRoom/examineeERoomList2',
                ['method' => 'post']
            ],
            'examineeIsTested' =>[
                'admin/ExaminationRoom/examineeIsTested',
                ['method' => 'post']
            ]           
        ]);
        Route::group('TestPersonnel',[
            'index'=> [
                'admin/TestPersonnel/index',
                ['method' => 'get']
            ],
            'changeStatus' =>[
                'admin/TestPersonnel/changeStatus',
                ['method' => 'get']
            ],
            'add' =>[
                'admin/TestPersonnel/add',
                ['method' => 'post']
            ],
            'edit' =>[
                'admin/TestPersonnel/edit',
                ['method' => 'post']
            ],
            'del' =>[
                'admin/TestPersonnel/del',
                ['method' => 'post']
            ],
            'getDetail' =>[
                'admin/TestPersonnel/getDetail',
                ['method' => 'get']
            ]           
        ]);
        Route::group('Subject',[
            'index'=> [
                'admin/Subject/index',
                ['method' => 'get']
            ],
            'changeStatus' =>[
                'admin/Subject/changeStatus',
                ['method' => 'get']
            ],
            'add' =>[
                'admin/Subject/add',
                ['method' => 'post']
            ],
            'edit' =>[
                'admin/Subject/edit',
                ['method' => 'post']
            ],
            'del' =>[
                'admin/Subject/del',
                ['method' => 'get']
            ],
            'getDetail' =>[
                'admin/Subject/getDetail',
                ['method' => 'get']
            ],
            'uploadExcel' =>[
                'admin/Subject/uploadExcel',
                ['method' => 'post']
            ],
            'getRandomSubject' =>[
                'admin/Subject/getRandomSubject',
                ['method' => 'get']
            ],
            'getSubjectNum' =>[
                'admin/Subject/getSubjectNum',
                ['method' => 'get']
            ],
            'getAllSubjectType' =>[
                'admin/Subject/getAllSubjectType',
                ['method' => 'get']
            ]          
        ]);
        Route::group('Menu',[
            'index'=> [
                'admin/Menu/index',
                ['method' => 'get', 'after_behavior' => ['\app\admin\behavior\ApiAuth']]
            ],
            'changeStatus' =>[
                'admin/Menu/changeStatus',
                ['method' => 'get']
            ],
            'add' =>[
                'admin/Menu/add',
                ['method' => 'post']
            ],
            'edit' =>[
                'admin/Menu/edit',
                ['method' => 'post']
            ],
            'del' =>[
                'admin/Menu/del',
                ['method' => 'get']
            ]            
        ]);
        Route::group('User',[
            'index'=> [
                'admin/User/index',
                ['method' => 'get']
            ],
            'getUsers' =>[
                'admin/User/getUsers',
                ['method' => 'get']
            ],
            'changeStatus' =>[
                'admin/User/changeStatus',
                ['method' => 'get']
            ],
            'add' =>[
                'admin/User/add',
                ['method' => 'post']
            ],
            'own' =>[
                'admin/User/own',
                ['method' => 'post']
            ],
            'edit' =>[
                'admin/User/edit',
                ['method' => 'post']
            ],
            'del' =>[
                'admin/User/del',
                ['method' => 'get']
            ],
        ]);
        Route::group('Auth',[
            'index'=> [
                'admin/Auth/index',
                ['method' => 'get']
            ],
            'changeStatus' =>[
                'admin/Auth/changeStatus',
                ['method' => 'get']
            ],
            'add' =>[
                'admin/Auth/add',
                ['method' => 'post']
            ],
            'delMember' =>[
                'admin/Auth/delMember',
                ['method' => 'get']
            ],
            'edit' =>[
                'admin/Auth/edit',
                ['method' => 'post']
            ],
            'del' =>[
                'admin/Auth/del',
                ['method' => 'get']
            ],
            'getGroups' =>[
                'admin/Auth/getGroups',
                ['method' => 'get']
            ],
            'getRuleList' =>[
                'admin/Auth/getRuleList',
                ['method' => 'get']
            ]
        ]);
        Route::group('App',[
            'index'=> [
                'admin/App/index',
                ['method' => 'get']
            ],
            'changeStatus' =>[
                'admin/App/changeStatus',
                ['method' => 'get']
            ],
            'add' =>[
                'admin/App/add',
                ['method' => 'post']
            ],
            'getAppInfo' =>[
                'admin/App/getAppInfo',
                ['method' => 'get']
            ],
            'edit' =>[
                'admin/App/edit',
                ['method' => 'post']
            ],
            'del' =>[
                'admin/App/del',
                ['method' => 'get']
            ]
        ]);
        Route::group('InterfaceList',[
            'index'=> [
                'admin/InterfaceList/index',
                ['method' => 'get']
            ],
            'changeStatus' =>[
                'admin/InterfaceList/changeStatus',
                ['method' => 'get']
            ],
            'add' =>[
                'admin/InterfaceList/add',
                ['method' => 'post']
            ],
            'refresh' =>[
                'admin/InterfaceList/refresh',
                ['method' => 'get']
            ],
            'edit' =>[
                'admin/InterfaceList/edit',
                ['method' => 'post']
            ],
            'del' =>[
                'admin/InterfaceList/del',
                ['method' => 'get']
            ],
            'getHash' =>[
                'admin/InterfaceList/getHash',
                ['method' => 'get']
            ]
        ]);
        Route::group('Fields',[
            'index'=> [
                'admin/Fields/index',
                ['method' => 'get']
            ],
            'request' =>[
                'admin/Fields/request',
                ['method' => 'get']
            ],
            'add' =>[
                'admin/Fields/add',
                ['method' => 'post']
            ],
            'response' =>[
                'admin/Fields/response',
                ['method' => 'get']
            ],
            'edit' =>[
                'admin/Fields/edit',
                ['method' => 'post']
            ],
            'del' =>[
                'admin/Fields/del',
                ['method' => 'get']
            ],
            'upload' =>[
                'admin/Fields/upload',
                ['method' => 'post']
            ]
        ]);
        Route::group('InterfaceGroup',[
            'index'=> [
                'admin/InterfaceGroup/index',
                ['method' => 'get']
            ],
            'getAll' =>[
                'admin/InterfaceGroup/getAll',
                ['method' => 'get']
            ],
            'add' =>[
                'admin/InterfaceGroup/add',
                ['method' => 'post']
            ],
            'changeStatus' =>[
                'admin/InterfaceGroup/changeStatus',
                ['method' => 'get']
            ],
            'edit' =>[
                'admin/InterfaceGroup/edit',
                ['method' => 'post']
            ],
            'del' =>[
                'admin/InterfaceGroup/del',
                ['method' => 'get']
            ]
        ]);
        Route::group('AppGroup',[
            'index'=> [
                'admin/AppGroup/index',
                ['method' => 'get']
            ],
            'getAll' =>[
                'admin/AppGroup/getAll',
                ['method' => 'get']
            ],
            'add' =>[
                'admin/AppGroup/add',
                ['method' => 'post']
            ],
            'changeStatus' =>[
                'admin/AppGroup/changeStatus',
                ['method' => 'get']
            ],
            'edit' =>[
                'admin/AppGroup/edit',
                ['method' => 'post']
            ],
            'del' =>[
                'admin/AppGroup/del',
                ['method' => 'get']
            ]
        ]);
        Route::group('Log',[
            'index'=> [
                'admin/Log/index',
                ['method' => 'get']
            ],
            'del' =>[
                'admin/Log/del',
                ['method' => 'get']
            ]
        ]);
        Route::miss('admin/Miss/index');
    },['after_behavior' => $afterBehavior]
);